package chixing.day18.work;

public class Printer {
    public synchronized void printDocument(String documentName)
    {

        System.out.println("打印文件：" + documentName);
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("打印完成");
    }
    public static void main(String[] args) {
        Printer printer = new Printer();
        Employee employee = new Employee("张三", "hello.txt", printer);
        Employee employee1 = new Employee("李四", "world.txt", printer);
        Employee employee2 = new Employee("王五", "java.txt", printer);
        Employee employee3 = new Employee("赵六", "python.txt", printer);
        employee.start();
        employee1.start();
        employee2.start();
        employee3.start();

    }
}
